<?php
namespace app\controller;

use think\Request;
use app\model\NavSiteType;
use app\model\ProjectComment;
use app\common\UtilService;
use app\validate\UserValidate;
use think\helper\Str;
use app\model\BbsComment;

class Comment extends Base
{
	/**
	 * [index 根据开源项目ID获取评论列表]
	 * @param  Request $request [description]
	 * @return [type]           [description]
	 */
	public function projectCommentList(Request $request)
	{
		try {

			$param = UtilService::getMore([
	            ['page', 1],
	            ['project_id',''],
	            ['parent_id','0'],
	        ]);

	        $list = ProjectComment::getProjectCommentList($param);

	        return success($list, '获取评论列表成功');
	        
        } catch (\Exception $e) {

            // 这是进行异常捕获
            return error($e->getMessage());
        }
	}

	/**
	 * [bbsCommentList bbs 详细页面获取评论列表]
	 * @since  2022-04-28
	 * @author Dai哥
	 * @param  Request    $request [description]
	 * @return [type]              [description]
	 */
	public function bbsCommentList(Request $request)
	{
		try {

			$param = UtilService::getMore([
	            ['page', 1],
	            ['limit',10],
	            ['bbs_id',''],
	            ['comment_id',''],
	        ]);

	        $list = BbsComment::getBbsCommentList($param);

	        return success($list, '获取评论列表成功');
	        
        } catch (\Exception $e) {

            // 这是进行异常捕获
            return error($e->getMessage());
        }
	}
}